var dirVars = require('./base/dir-vars.config.js');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var path = require('path');
module.exports = {
  rules: [{
    test: /\.css$/,
    include: dirVars.pagesDir,
    use: ExtractTextPlugin.extract([{
      loader: 'css-loader?sourceMap'
    }, {
      loader: 'postcss-loader',
      options: {
        plugins() {
          return [require('precss'), require('autoprefixer')({
            remove: false,
            browsers: ['ie >= 6', '> 1% in CN'],
          })];
        },
      },
    }, ]),
  }, {
    test: /\.scss$/,
    include: /node_modules/,
    use: [{
      loader: "style-loader" // creates style nodes from JS strings
    }, {
      loader: "css-loader" // translates CSS into CommonJS
    }, {
      loader: "sass-loader" // compiles Sass to CSS
    }]
  }, {
    test: /\.(png|jpg|gif)$/,
    include: dirVars.srcRootDir,
    use: {
      loader: 'file-loader',
      options: {
        //limit: 8192,
        name: 'images/[hash:8].[ext]'
      }
    }
  }, {
    test: /\.html$/,
    use: {
      loader: 'html-loader'
    }
  }]
}
